/**
 * Created by George on 2018/1/27.
 */
var app = angular.module('appNote', ["ui.router", "oc.lazyLoad"]);

app.config(["$provide", "$compileProvider", "$controllerProvider", "$filterProvider",
    function ($provide, $compileProvider, $controllerProvider, $filterProvider) {
        app.controller = $controllerProvider.register;
        app.directive = $compileProvider.directive;
        app.filter = $filterProvider.register;
        app.factory = $provide.factory;
        app.service = $provide.service;
        app.constant = $provide.constant;
    }]);

app.config(["$stateProvider", "$urlRouterProvider", routeFn]);
function routeFn($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise("/user");
    $stateProvider
        .state("user", {
            url: "/user",
            templateUrl: "/web/view/user.html",
            controller: "userCtrl",
            resolve: {
                deps: ["$ocLazyLoad", function ($ocLazyLoad) {
                    return $ocLazyLoad.load("/web/js/userCtrl.js");
                }]
            }
        })
        .state("activity", {
            url: "/activity",
            templateUrl: "/web/view/activity.html",
            controller: "activityCtrl",
            resolve: {
                deps: ["$ocLazyLoad", function ($ocLazyLoad) {
                    return $ocLazyLoad.load("/web/js/activityCtrl.js");
                }]
            }
        })
        .state("dues", {
            url: "/dues",
            templateUrl: "/web/view/dues.html",
            controller: "duesCtrl",
            resolve: {
                deps: ["$ocLazyLoad", function ($ocLazyLoad) {
                    return $ocLazyLoad.load("/web/js/duesCtrl.js");
                }]
            }
        })
};

(function () {
    app.controller('appNoteCtrl', function ($scope) {
        this.value = "welcome to activityCtrl";
        $scope.welcome_info = "this is appNoteCtrl page.";
    });
}());


